/* 
 * File:   global_definitions.h
 * Author: oddi
 *
 * Created on January 25, 2010, 6:55 PM
 */

#ifndef _GLOBAL_DEFINITIONS_H
#define	_GLOBAL_DEFINITIONS_H

#ifdef	__cplusplus
extern "C" {
#endif

#ifdef __WINDOWS__
#define HOMEDIR "C:/es1/savedir"
#else
#define HOMEDIR "/home/oddi/Code/edistr/test"
#endif

#define VERBOSEOUT stdout
#define MAX_BUF_SIZE 256

#define ERROR -1
#define OK 0
#define X 0
#define Y 1
#define Z 2

#define VX 0
#define VY 1
#define VZ 2


    /*physical constants*/
#define ELECTRON_MASS (9.109e-28)
#define ELECTRON_CHARGE (-4.8032e-10)
#define LIGHT_SPEED (3e10)
#define E_M (ELECTRON_CHARGE)/(ELECTRON_MASS)
#define BOLTZMAN_CONST (1.6e-12)
#define PI (3.141592654) //shuold be more precise?
#define QMC  (ELECTRON_CHARGE)/(ELECTRON_MASS)/(LIGHT_SPEED)
#define ERG_IN_V (1.602e-12)

#define CELLSIZE  (0.1)
#define MINZ  (0)
#define L (10000.0)
#define MAXZ ( L + CELLSIZE)
#define CYCLES  (50e3)
#define DT  (0.25 * 1e-9)
#define BEAMSPEED (1e7)

#define PULSEDURATION (1100*1e-9)
#define PULSEDELAY (5*1e-9)
#define PULSECENTRE_ZPOS  (L/2)
#define PULSEWIDTH (1)
#define PULSEINCTIME (1000*1e-9)
#define PULSEDELTIME (PULSEDURATION - PULSEINCTIME)
    
    /*common macros*/
#define MAX(a,b) ((a >= b) ? (a) : (b))
#define MIN(a,b) ((a <= b) ? (a) : (b))


    /*used float type*/
    typedef double floatdig;

    typedef struct struct_vector3d {
        floatdig v[3];
    } vector3d;

    typedef floatdig time;
    typedef vector3d pos3d;
    typedef vector3d size3d;
    typedef vector3d speed3d;
    typedef vector3d efield3d;
    typedef vector3d bfield3d;

#ifdef	__cplusplus
}
#endif

#endif	/* _GLOBAL_DEFINITIONS_H */

